from flask import request


#before_request    after_request    teardown_request   errorhandler

def load_middleware(app):
    @app.before_request             #注意：app的优先级会高于蓝图的
    def before():
        print('这是中间件，app的before: ' , request.url)


        """用于
            统计
            优先级
            反爬
                频率
            用户认证
            用户权限
        """


    @app.after_request
    def after(response):
        print(response)
        return response
